package com.hpin.mlxteacher.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hpin.mlxteacher.R;
import com.hpin.mlxteacher.bean.SchoolClassReq;

import java.util.List;

/**
 * Created by Administrator on 2015/11/11.
 */
public class ChildSchoolClassAdapter extends BaseAdapter {

    private Context ctx;
    private List<SchoolClassReq.MyClassesList> temList;
    public ChildSchoolClassAdapter(Context ctx, List<SchoolClassReq.MyClassesList> temList) {
        this.ctx = ctx;
        this.temList = temList;
    }
    public void setData(List<SchoolClassReq.MyClassesList> temList) {
        this.temList = temList;
    }
    @Override
    public int getCount() {
        return temList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder=null;

        if (convertView == null) {

            convertView = View.inflate(ctx, R.layout.item_child_school_classadapter, null);
            viewHolder = new ViewHolder();
            viewHolder.tv_school_grade = (TextView)convertView.findViewById(R.id.tv_school_grade);

            convertView.setTag(viewHolder);

        }else{
            viewHolder=(ViewHolder) convertView.getTag();
        }
        viewHolder.tv_school_grade.setText(temList.get(position).nickName);
        return convertView;
    }
    private class ViewHolder {
        private TextView tv_school_grade;
    }
}
